package com.andnnl.config;

import org.beetl.ext.spring.BeetlGroupUtilConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternUtils;

@Configuration
public class BeetlFrameworkConfig {


    /**
     *内容模板配置
     * @return
     */

  @Bean(name = "beetlContentTemplateConfig")
  public BeetlGroupUtilConfiguration getContentBeetlUtilConfiguration() {
      BeetlGroupUtilConfiguration beetlGroupUtilConfiguration = new BeetlGroupUtilConfiguration();
      ResourcePatternResolver patternResolver = ResourcePatternUtils.getResourcePatternResolver(new DefaultResourceLoader());
      
      beetlGroupUtilConfiguration.setConfigFileResource(patternResolver.getResource("classpath:beetl.properties"));
//      ClasspathResourceLoader cploder = new ClasspathResourceLoader("/elasticsearch");
//      beetlGroupUtilConfiguration.setResourceLoader(cploder);
      
      beetlGroupUtilConfiguration.init();
      
      return beetlGroupUtilConfiguration;
  }



}
